import {CrownCADPlugin} from "../../nodeApp/static/lib/crowncad-plugin-sdk-0.0.1";

export class Generator{
  constructor() {}

  /**
   * 初始化，创建 SDK 插件对象
   */
  init(maxWidth = 500, minWidth = 500, maxHeight = 550, cb = () => {}) {
    const crownCADPlugin = new CrownCADPlugin();
    crownCADPlugin.setParentOrigin("http://localhost:8080");
    crownCADPlugin.setMaxAttempt(5);
    crownCADPlugin.setLayout(maxWidth, minWidth, maxHeight);
    crownCADPlugin.connect().then(() => {
      this.command = crownCADPlugin.command;
      this.request = crownCADPlugin.request;
      cb();
    });
  }
}